<?php
header("Content-Type:text/html;charset=utf-8");
include_once "../inc/config.php";
include_once "../inc/config_db.php";
if(function_exists('date_default_timezone_set')) { 
date_default_timezone_set('Hongkong');
}
$name = str_check( uh( $_POST['name']));
$contact = str_check( uh( $_POST['contact']));
$companyname = str_check( uh( $_POST['company']));
$title = str_check( uh( $_POST['title']));
$content = str_check( uh( $_POST['content']));
$ip = getenv('REMOTE_ADDR');
$time = date("Y-m-d H-i-s");
if (empty($content) || empty($name) || empty($title)) {
	echo "<SCRIPT language=JavaScript>alert('姓名、留言主题、留言内容不能为空！');javascript:history.go(-1);</SCRIPT>";
	exit;
}
$db->query("INSERT INTO tun2_book (name,contact,companyname,title,content,ip,time,verify,reply) VALUES ('$name','$contact','$companyname','$title','$content','$ip','$time','0','')");
echo "<SCRIPT language=JavaScript>alert('您的留言已提交，我们将尽快给您答复！');javascript:document.location.href('../class.php?id=".$_GET['id']."');</SCRIPT>";
?>
